package com.mproject.activity;

import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;

import com.mproject.network.ProgressBarManager;

public class SplashScreen extends Activity {

	public static SharedPreferences mypref;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		mypref=getSharedPreferences("My_Prefs",Activity.MODE_WORLD_WRITEABLE);
		registerID();

		ProgressBarManager manager=new ProgressBarManager(this)
		{
			protected void onPreExecute() 
			{

				Log.v("manager"," in pre execute");

			}
			protected void onPostExecute(Boolean value)
			{

				//	Log.v("spalsh screen","now displaying");
				//Intent intent = new Intent(SplashScreen.this, LogIn.class);
				//SplashScreen.this.startActivity(intent);

				Intent intent = new Intent(SplashScreen.this, LoginActivity.class);
				startActivity(intent);
				finish();

			}
		};
		manager.execute();

	}

	//method to register registration ID from google server
	public void registerID() {
		Log.w("C2DM", "start registration process");
		Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER");
		intent.putExtra("app",
				PendingIntent.getBroadcast(this, 0, new Intent(), 0));

		// Sender currently not used
		intent.putExtra("sender", "goodemployeeguys@gmail.com");
		startService(intent);
	}




}